Starting Playback
Just Press Play
If using the default Reactional prefab, you can toggle the Autoplay bool in Basic Playback to start playback immediately. However, in most use cases you would want more control of when and how music is played back.
By default, the Basic Playback script will run the Reactional.Setup.LoadBundles()
function which populate the ReactionalManager with the tracks and themes available in the project.
After having done that, an asynchronous load of the theme’s assets and the current playlist track, will occur.
When ready, the AllowPlay-flag will be set, and the system will be available.
Below you can see a condensed implementation of a playback script:
BasicPlayback
using UnityEngine;
using System.Threading.Tasks;
namespace Reactional.Core
{
[DefaultExecutionOrder(5000)]
public class BasicPlayback : MonoBehaviour
{
[SerializeField] private bool _autoplayTheme;
[SerializeField] private bool _autoplayTrack;
[Range(0f,1f)]
public float _themeVolume = 1f;
[Range(0f,1f)]
// ... (click to expand)